package com.sikaryofficial.backend.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * @author : qinjinyuan
 * @desc : 0-未发放 1-已发放
 * @date : 2023/11/04 10:08
 */
@Getter
@AllArgsConstructor
public enum PrizeGrantStatusEnum {

    NO(0, "未发放"),

    YES(1, "已发放");

    private final Integer code;
    private final String name;

    public static PrizeGrantStatusEnum getNameByCode(Integer code) {
        return Arrays.stream(PrizeGrantStatusEnum.values())
                .filter(pointRuleEnum -> Objects.nonNull(code) && pointRuleEnum.getCode().equals(code))
                .findFirst().orElse(null);
    }
}
